import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Main',
    component:()=>import('../views/Main.vue'),
    // 子路由path不用带 / 
    children:[
      {
        path:'home',
        name:'Home',
        alias:'',
        component:()=>import('../views/Home.vue')
      },
      {
        path:'menu',
        name:'Menu',
        component:()=>import('../views/Menu.vue')
      },
      {
        path:'shopbag',
        name:'Shopbag',
        component:()=>import('../views/Shopbag.vue')
      },
      {
        path:'order',
        name:'Order',
        component:()=>import('../views/Order.vue')
      },
      {
        path:'my',
        name:'My',
        component:()=>import('../views/My.vue')
      },
    ]
  },
  {
    path:'/detail',
    name:'Detail',
    component:()=>import('../views/Detail.vue')
  },
  {
    path:'/login',
    name:'Login',
    component:()=>import('../views/Login.vue')
  },
  {
    path:'/register',
    name:'Register',
    component:()=>import('../views/Register.vue')
  },
  {
    path:'/personal',
    name:'Personal',
    component:()=>import('../views/Personal.vue')
  },
  {
    path:'/makeorder',
    name:'MakeOrder',
    component:()=>import('../views/MakeOrder.vue')
  },
  {
    path:'/addresslist',
    name:'AddressList',
    component:()=>import('../views/AddressList.vue'),
    // meta:{keepAlive:true}
  },
  {
    path:'/addressedit',
    name:'AddressEdit',
    component:()=>import('../views/AddressEdit.vue')
  },
  {
    path:'/addressadd',
    name:'AddressAdd',
    component:()=>import('../views/AddressAdd.vue')
  },
  {
    path:'/mycollect',
    name:'MyCollect',
    component:()=>import('../views/MyCollect.vue')
  },
  {
    path:'/myorder',
    name:'MyOrder',
    component:()=>import('../views/MyOrder.vue')
  },
  {
    path:'/install',
    name:'Install',
    component:()=>import('../views/Install.vue')
  },
  {
    path:'/findpassword',
    name:'FindPassword',
    component:()=>import('../views/FindPassword.vue')
  }
  
]

const router = new VueRouter({
  routes
})

export default router
